package com.ai.model.edu.log;

import java.math.BigDecimal;

public class NginxUrlErrorRate {

	private String key;

	private long e200;

	private long e500;

	private double rate;

	public double getRate() {
		if (e500 == 0) {
			rate = (double) 1;
		} else {
			BigDecimal b = new BigDecimal(
					((double) e200 / (double) (e500 + e200)));
			double r = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();

			rate = r;
		
		}
		return rate;
	}

	public String getKey() {
		return key;
	}

	public void setKey(String key) {
		this.key = key;
	}

	public double getE200() {
		return e200;
	}

	public void setE200(long e200) {
		this.e200 = e200;
	}

	public double getE500() {
		return e500;
	}

	public void setE500(long e500) {
		this.e500 = e500;
	}

}
